<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子35-JS进阶（二）</title>
    </head>

    <body>
        <pre>
            <code>
                    // 例子35

                    var person = {
                        name: 'Tom'
                    }

                    // 修改name的值
                    person.name = 'Jerry';

                    // 查看修改结果
                    console.log(person.name); // Jerry 修改成功

                    // 设置name的值不能被修改
                    Object.defineProperty(person, 'name', {
                        writable: false
                    })

                    // 再次试图修改name的值
                    person.name = 'Jimmy';

                    console.log(person.name); // Jerry 修改失败
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/35.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>

</html>